<?php

require_once("lib/exception/internal_error_exception.php");

class Autor_dao_factory {

	static private $instance;
	
	private function __construct() {}
	
	
	public static function singleton() {		
		
		if (!isset(self::$instance)) {
			$c = __CLASS__;
			self::$instance = new $c;			
		}
		
		return self::$instance;	 
	}
	
	
	public function get_dao() {
    	try {
    		if (include_once AUTOR_DAO_FACTORY_DAOCLASSNAM . '.php') {
            	$classname = AUTOR_DAO_FACTORY_DAOCLASSNAM;
            	return new $classname;
        	} else {
            	throw new Exception ("Driver autor not found");
        	}
    	}
    	catch (Exceptio $e) {
    		throw new Internal_error_exception($e);
    	}
	}
}
?>